package sy5_Structural_Pattern.Bridge;




abstract class Shape{
    protected Color color;

    public Shape(Color color) {
        this.color = color;
    }

    public abstract void draw();
}

interface Color{
    void applyColor();
}
class Red implements Color{
    @Override
    public void applyColor() {
        System.out.println("Applying red color");
    }
}
class Blue implements Color{

    @Override
    public void applyColor() {
        System.out.println("Applying blue color");
    }
}

class Circle extends Shape{

    public Circle(Color color) {
        super(color);
    }

    @Override
    public void draw() {
        System.out.println("Drawing a circle.");
        color.applyColor();
    }
}
class Square extends Shape{
    public Square(Color color) {
        super(color);
    }

    @Override
    public void draw() {
        System.out.println("Drawing a square.");
        color.applyColor();
    }
}
public class Client {
    public static void main(String[] args) {
        Shape circle = new Circle(new Red());
        Square square = new Square(new Blue());

        circle.draw();
        square.draw();
    }
}
